/*
 * Created on 30.01.2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package ro.qi.framework.sys.security.entities;

import java.util.Date;

import ro.qi.framework.sys.entities.Entity;

/**
 * @author Denverash
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class SecurityAccount extends Entity {

	public SecurityAccount() {
		super();
	}

	public SecurityAccount(int id) {
		super();
		setId(id);
		select();
	}

	public SecurityAccount(String login) {
		super();
		setLogin(login);
		select();
	}

	/*
	 * @deprecated
	 */
	public SecurityAccount(String login, int siteId) {
		super();
		setLogin(login);
		setSiteId(siteId);
		select();
	}

	public void setId(int value) {
		setValue("id", value);
	}

	public int getId() {
		return getIntValue("id");
	}

	public void setSiteId(int value) {
		setValue("siteId", value);
	}

	public int getSiteId() {
		return getIntValue("siteId");
	}

	public void setLogin(String value) {
		setValue("login", value);
	}

	public String getLogin() {
		return getStringValue("login");
	}

	public void setPassword(String value) {
		setValue("password", value);
	}

	public String getPassword() {
		return getStringValue("password");
	}

	public void setEmail(String value) {
		setValue("email", value);
	}

	public String getEmail() {
		return getStringValue("email");
	}

	public void setFirstName(String value) {
		setValue("firstName", value);
	}

	public String getFirstName() {
		return getStringValue("firstName");
	}

	public void setFamilyName(String value) {
		setValue("familyName", value);
	}

	public String getFamilyName() {
		return getStringValue("familyName");
	}

	public void setGender(String value) {
		setValue("gender", value);
	}

	public String getGender() {
		return getStringValue("gender");
	}

	public void setBirthdate(Date value) {
		setValue("birthdate", value);
	}

	public Date getBirthdate() {
		return (Date)getValue("birthdate");
	}

	public void setPhone(String value) {
		setValue("phone", value);
	}

	public String getPhone() {
		return getStringValue("phone");
	}

	public void setFax(String value) {
		setValue("fax", value);
	}

	public String getFax() {
		return getStringValue("fax");
	}

	public void setLocked(boolean value) {
		setValue("locked", value);
	}

	public boolean isLocked() {
		return getBooleanValue("locked");
	}

	public Date getCreatedTime() {
		return getDateValue("createdTime");
	}

	public Date getUpdatedTime() {
		return getDateValue("updatedTime");
	}

	public String getFullName() {
		StringBuffer fullName = new StringBuffer();
		if (getFirstName().trim().length() > 0) {
			fullName.append(getFirstName()+ " ");
		}
//		if (getMiddleName().trim().length() > 0) {
//			fullName.append(getMiddleName()+ " ");
//		}
		if (getFamilyName().trim().length() > 0) {
			fullName.append(getFamilyName());
		}
		return fullName.toString().trim();
	}

}
